--TEST--
int MySQLndUhConnection::getProtocolInformation(resource $connection)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
	require_once('config.inc');

	class proxy extends MySQLndUhConnection {
		public function getProtocolInformation($res) {
			printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
			var_dump($ret = parent::getProtocolInformation($res));
			return $ret;
		}
	}

	class proxy2 extends MySQLndUhConnection {
		public function getProtocolInformation($res) {
			return 2;
		}
	}

	class proxy3 extends MySQLndUhConnection {
		public function getProtocolInformation($res) {
			$ret = array();
			return $ret;
		}
	}

	class proxy4 extends MySQLndUhConnection {
		public function getProtocolInformation($res) {}
	}

	class proxy5 extends MySQLndUhConnection {
		public function getProtocolInformation($res) { return PHP_INT_MAX; }
	}

	class proxy6 extends MySQLndUhConnection {
		public function getProtocolInformation($res) { return -1.01; }
	}

	$conn = mysqlnd_uh_test\connect::mysqli();
	mysqlnd_uh_test\query_test::mysqli($conn);
	$org = $conn->protocol_version;

	$conn = mysqlnd_uh_test\connect::mysqli();
	mysqlnd_uh_set_connection_proxy(new proxy());
	mysqlnd_uh_test\query_test::mysqli($conn);

	if (($tmp = $conn->protocol_version) != $org)
		printf("[001] Protocol version has changed from %s to %s\n", $org, $tmp);

	mysqlnd_uh_set_connection_proxy(new proxy2());
	var_dump($tmp = $conn->protocol_version);
	var_dump($conn->protocol_version);

	$conn = mysqlnd_uh_test\connect::mysqli();
	mysqlnd_uh_set_connection_proxy(new proxy3());
	var_dump($conn->protocol_version);

	mysqlnd_uh_set_connection_proxy(new proxy4());
	var_dump($conn->protocol_version);

	mysqlnd_uh_set_connection_proxy(new proxy5());
	var_dump($conn->protocol_version);

	mysqlnd_uh_set_connection_proxy(new proxy6());
	var_dump($conn->protocol_version);

	print "done!";
?>
--EXPECTF--
proxy::getProtocolInformation(array (
  0 => NULL,
))
int(10)
int(2)
int(2)

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getProtocolInformation() did not return a numeric value as it should (C type used by mysqlnd: "unsigned int") in %s on line %d
int(%d)

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getProtocolInformation() did not return a numeric value as it should (C type used by mysqlnd: "unsigned int") in %s on line %d
int(0)
int(%d)
int(%d)
done!
